package com.wanmait.recycle.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wanmait.recycle.mapper.UnitMapper;
import com.wanmait.recycle.pojo.Rubbish;
import com.wanmait.recycle.pojo.Unit;
import com.wanmait.recycle.service.UnitService;
import com.wanmait.recycle.util.Pager;

@Service
@Transactional
public class UnitServiceImpl implements UnitService {

	@Resource
	private UnitMapper unitMapper;
	
	@Override
	public void insert(Unit object) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(Unit object) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(Integer id) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(String ids) {
		ids = ids.substring(0, ids.length()-1);
		String[] nn =ids.split(",");
		
 		unitMapper.deleteMove(nn);
	}

	@Override
	public Unit findById(Integer id) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Unit> findAllUnits() {
		// TODO Auto-generated method stub

		

		return unitMapper.findAll();

	}

	@Override
	public int getDataCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	

	

	
	public void deleteOne(Integer id) {

		unitMapper.deleteOne(id);
		
	}

	@Override
	public void recallOne(Integer id) {
		unitMapper.recallOne(id);
		
	}

	@Override
	public void addUnit(String name) {
		int i =unitMapper.getMaxId();
		unitMapper.addUnit(name,i+1);
		
	}

	@Override
	public void updateUnit(Unit unit) {
		
		unitMapper.updateUnit(unit);
		
	}

	

	@Override
	public List<Unit> findAll() {
		// TODO Auto-generated method stub
		return unitMapper.findAll();
	}

	@Override
	public List<Unit> findAllUnit() {
		// TODO Auto-generated method stub
		return unitMapper.findAllUnit();
	}

	@Override
	public void changeSortCount(Integer id, Integer tcount) {
		
		unitMapper.changeSortCount(id,tcount);
	}

}
